package com.mxx.common.data.jpa;

import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.CriteriaUpdate;
import javax.persistence.criteria.Root;

public interface LambdaUpdateSpec<T> extends UpdateSpecification<T> {

    @Override
    default Result buildUpdate(Root root, CriteriaBuilder criteriaBuilder, CriteriaQuery criteriaQuery, CriteriaUpdate criteriaUpdate) {
        return this.helper(new LambdaUpdateSpecHelper<>(root, criteriaBuilder, criteriaQuery, criteriaUpdate));
    }

    Result helper(LambdaUpdateSpecHelper<T> helper);
}
